luajit2: fix build and runtime on powerpc - #30280
Merged
Merged
Conversation
BKPepe
force-pushed
the
luajit2-powerpc-fixes
branch
from
August 15, 2026 07:13
dc3279c to
278d80b
Compare
BKPepe
force-pushed
the
luajit2-powerpc-fixes
branch
from
August 15, 2026 07:30
278d80b to
8ea5f7d
Compare
BKPepe
marked this pull request as ready for review
August 15, 2026 09:05
luajit2 currently fails to link for powerpc: lj_vm.o emits PLT calls that force BSS-PLT, which the inline-PLT relocations emitted by GCC 12 and newer do not support. Add the same GOT-based fix that lang/lua/luajit has carried as 060-ppc-musl.patch since 2019. With that in place the package builds, but ipairs() and pairs() turn out to be broken on 32-bit big-endian soft-float targets. Both are regressions in luajit2's PPC64 patch and do not affect upstream LuaJIT. To be submitted to openresty/luajit2 as well. Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
BKPepe
force-pushed
the
luajit2-powerpc-fixes
branch
from
August 15, 2026 09:21
8ea5f7d to
475ad1b
Compare
This was referenced Aug 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📦 Package Details
Maintainer: @jmarcet
Description:
luajit2cannot currently be built for powerpc — the link oflibluajit.sofails with:Clint Bland proposed this fix upstream in LuaJIT/LuaJIT#486, made against 2.0 and addressing LuaJIT/LuaJIT#481, and it was closed without being merged.
lang/lua/luajithas carried it as060-ppc-musl.patchsince 2019, extended with the soft-float helpers that the 2.1 branch needs in the GOT.luajit2never got either version. Patch 050 ports it and keeps Clint Bland as the author of the commit.With the package building again, two iteration paths turn out to be broken on 32-bit big-endian soft-float. Patches 030 and 040 fix those. Both are regressions introduced by openresty/luajit2@2763a421 and do not affect upstream LuaJIT.
The runtime fixes were verified with small Lua programs exercising both iteration functions:
Before the fixes, the
ipairs()test produces-42instead of60, whilepairs()yields an extranil nilentry. With the fixes, both tests pass.ipairs({10,20,30})sum-4260pairs({7,8,9})nil nilrowPossibly related: openresty/luajit2#118 reports a powerpc startup crash. I could not reproduce that one — its backtrace is inside the glibc loader before
main(), whereas the crash fixed by patch 050 happens after the loader has finished. Linking it here in case it turns out to be the same thing for the reporter.The three patches will be submitted to openresty/luajit2 in parallel.
🧪 Run Testing Details
luajit2-2.1.2026.02.27-r2.apkon the device and ran the tests above —ipairsreturns 60,pairsiterates cleanly,math.sin/math.sqrtare correct and the JIT is enabled. Since this is aBUILDMODE=dynamicpackage, it also confirms the PLT fix in the real packaging configuration.powerpc_8548)Tested on real hardware, not only as a cross-compile/CI build. The same
ipairs()misbehaviour was also confirmed against TurrisOS 9.1 on the same device, where the distro's upstream LuaJIT (luajit 2.1.0-beta3-r7) returns the correct results — which is what pinned these down as luajit2-only regressions.✅ Formalities
If your PR contains a patch:
git amDraft — opened to get a
powerpc_8548CI build and a package to test on real hardware before submitting the patches upstream.